package factorymethod

type PaymentFactory interface {
	Create() Payment
}

// 支付宝支付网关工厂
type AlipayFactory struct {
	appId     string
	appSecret string
}

func NewAlipayFactory(appId, appSecret string) *AlipayFactory {
	return &AlipayFactory{
		appId:     appId,
		appSecret: appSecret,
	}
}

func (a *AlipayFactory) Create() Payment {
	return NewAliPay(a.appId, a.appSecret)
}

// 微信支付网关工厂
type WechatPayFactory struct {
	merchantID string
	apiKey     string
}

func NewWechatPayFactory(merchantID, apiKey string) *WechatPayFactory {
	return &WechatPayFactory{
		merchantID: merchantID,
		apiKey:     apiKey,
	}
}

func (w *WechatPayFactory) Create() Payment {
	return NewWechatPay(w.merchantID, w.apiKey)
}
